from flask import Flask, jsonify
from flask_cors import CORS
from analyse.analyse import *

app = Flask(__name__)
CORS(app, resources=r'/*')


@app.route('/')
def hello_world():
    return 'Hello World!'


@app.route('/bar', methods=['POST'])
def bar():
    return jsonify(mean_unit_price())


@app.route('/pie', methods=['POST'])
def pie():
    return jsonify(diff_orient_ratio())


@app.route('/scatter', methods=['POST'])
def scatter():
    return jsonify(scatter_data())


@app.route('/heatmap', methods=['POST'])
def heatmap():
    return jsonify(heatmap_data())


@app.route('/wordCloud', methods=['POST'])
def word_cloud():
    return jsonify(title_word_frequency_top50())


@app.route('/funnel', methods=['POST'])
def funnel():
    return jsonify(funnel_data())


if __name__ == '__main__':
    app.run()
